home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / linux / atari / source / source.lzh / atari-linux-0.01pl3 / lib / open.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-05  |  845 b   |  42 lines

  1. /*
  2.  *  linux/lib/open.c
  3.  *
  4.  *  Copyright (C) 1991, 1992  Linus Torvalds
  5.  *
  6.  * This file is subject to the terms and conditions of the GNU General Public
  7.  * License.  See the file README.legal in the main directory of this archive
  8.  * for more details.
  9.  */
  10.  
  11. /*
  12.  * 680x0 support by Hamish Macdonald
  13.  */
  14.  
  15. #define __LIBRARY__
  16. #include <linux/unistd.h>
  17. #include <stdarg.h>
  18.  
  19. int open(const char * filename, int flag, ...)
  20. {
  21.     register int res __asm__ ("d0");
  22.     va_list arg;
  23.  
  24.     va_start(arg,flag);
  25.     __asm__("movel %1,d1\n\t"
  26.         "movel %2,d2\n\t"
  27.         "movel %3,d3\n\t"
  28.         "movel %0,d0\n\t"
  29.         "trap  #0\n\t"
  30.         "tstl  d0\n\t"
  31.         "bpl   1f\n\t"
  32.         "negl  d0\n\t"
  33.         "movel d0,_errno\n\t"
  34.         "moveq #-1,d0\n\t"
  35.         "1:"
  36.         : /* no outputs */
  37.         : "i" (__NR_open), "g" (filename), "g" (flag),
  38.         "d" (va_arg(arg,int)) : "d0", "d1", "d2", "d3" );
  39.     va_end(arg);
  40.     return res;
  41. }
  42.